﻿using Cms.Domain.Authentication;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Cms.Tests.Unit.WebFramework.Infrastructure.Authentication
{
    [TestClass]
    public class AuthenticatedUserTests
    {
        [TestMethod]
        public void GetName_OnlyUserSet_ReturnOnlyUser()
        {
            AuthenticatedUser authenticatedUser = new AuthenticatedUser { UserID = 1 };
            Assert.AreEqual("U1", authenticatedUser.GetName());
        }

        [TestMethod]
        public void GetName_OnlyAdministratorSet_ReturnOnlyAdministrator()
        {
            AuthenticatedUser authenticatedUser = new AuthenticatedUser { AdministratorID = 2 };
            Assert.AreEqual("A2", authenticatedUser.GetName());
        }

        [TestMethod]
        public void GetName_BothSet_ReturnBoth()
        {
            AuthenticatedUser authenticatedUser = new AuthenticatedUser { UserID = 1, AdministratorID = 2 };
            Assert.AreEqual("U1|A2", authenticatedUser.GetName());
        }
    }
}
